unit Settings;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, sPanel, StdCtrls, sLabel, sEdit, sSpinEdit, sComboBox,
  ICore.Utils.XML, sCheckBox, sButton;

type
  TFormSettings = class(TForm)
    sPanel1: TsPanel;
    DecimalSpinEditCheckTime: TsDecimalSpinEdit;
    sLabel1: TsLabel;
    CheckBoxSettingsMinimize: TsCheckBox;
    sButton1: TsButton;
    procedure DecimalSpinEditCheckTimeChange(Sender: TObject);
    procedure CheckBoxSettingsMinimizeClick(Sender: TObject);
    procedure sButton1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }

  end;

var
  FormSettings: TFormSettings;

implementation

uses Main;

{$R *.dfm}

procedure TFormSettings.CheckBoxSettingsMinimizeClick(Sender: TObject);
begin
  Form1.Settings['Main'].Params.AddParam('StartMinimized', AnsiString(BoolToStr(CheckBoxSettingsMinimize.Checked)));
  Form1.Settings.SaveToFile(SettingsFile);
end;

procedure TFormSettings.DecimalSpinEditCheckTimeChange(Sender: TObject);
begin
  Form1.Timer1.Interval := Round(DecimalSpinEditCheckTime.Value * 60000);
  Form1.Settings['Main'].Params.AddParam('Interval', AnsiString(FloatToStr(DecimalSpinEditCheckTime.Value)));
  Form1.Settings.SaveToFile(SettingsFile);
end;

procedure TFormSettings.sButton1Click(Sender: TObject);
begin
  Close;
end;

end.
